from com.github.taomus.fig.jython import Requests

class Response:
    def __init__(self):
        self.status_code = None
        self.text = None
        self.url = None
        self.encoding = None
        self.content = None
        self.cookie = None

class utils:
    @staticmethod
    def dict_from_cookiejar(a):
        return a

def delete(url,params = None,headers = None):
    request = Requests()
    req = request.request("delete",url)
    if params != None:
        req.params(params)
    if headers != None:
        req.headers(headers)
    resp = req.execute()
    response = Response()
    response.status_code = resp.statusCode()
    response.text = resp.body()
    response.url = resp.url()
    response.encoding = resp.charset()
    response.cookie = resp.cookies()
    return response

def put(url,params = None,headers = None):
    request = Requests()
    req = request.request("put",url)
    if params != None:
        req.params(params)
    if headers != None:
        req.headers(headers)
    resp = req.execute()
    response = Response()
    response.status_code = resp.statusCode()
    response.text = resp.body()
    response.url = resp.url()
    response.encoding = resp.charset()
    response.cookie = resp.cookies()
    return response

def post(url,params = None,headers = None):
    request = Requests()
    req = request.request("post",url)
    if params != None:
        req.params(params)
    if headers != None:
        req.headers(headers)
    resp = req.execute()
    response = Response()
    response.status_code = resp.statusCode()
    response.text = resp.body()
    response.url = resp.url()
    response.encoding = resp.charset()
    response.cookie = resp.cookies()
    return response

def get(url,params = None,headers = None):
    request = Requests()
    req = request.request("get",url)
    if params != None:
        req.params(params)
    if headers != None:
        req.headers(headers)
    resp = req.execute()
    response = Response()
    response.status_code = resp.statusCode()
    response.text = resp.body()
    response.url = resp.url()
    response.encoding = resp.charset()
    response.cookie = resp.cookies()
    return response
